﻿@model Zor_Web.Models.Base.V_Zor_Acceptance_Jdb
@using Webdiyer.WebControls.Mvc;
@using Zor_Tools;
@{
    Layout = null;
}
<!DOCTYPE html>

<html>
<head>
    
    <meta name="viewport" content="width=device-width" />
    <title>受理单打印-街道办</title>
    <link href="~/Content/LayerUI/src/css/layui.css" rel="stylesheet" />
    <link href="~/Content/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="~/Content/Styles/zor.css" rel="stylesheet" />
    <!-- 框架必要 -->
    <script src="~/Content/Scripts/jquery/jquery-1.9.1.min.js"></script>
    <script src="~/Content/Scripts/learunui-framework.js"></script>
    <script src="~/Content/Scripts/Zor_AJax.js"></script>
    <!-- 消息提示 -->
    <script language='javascript' src='~/Content/layer/layer.js'></script>
    <!-- 日期选择器 -->
    <script src="~/Content/laydate/laydate.js"></script>
    <!-- 打印控件 -->
    <script src="~/Zor/Lodop/LodopFuncs.js"></script>
    <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width=0 height=0>
        <embed id="LODOP_EM" type="application/x-print-lodop" width=0 height=0></embed>
    </object>
</head>
<body class="gray-bg">
   

    <div class="layui-tab layui-tab-brief main-tab-container ">
        <div class="col-sm-12 ct-padding">
            <div class="col-sm-9 ct-padding">
                <button id="btnPrint" class="layui-btn layui-btn-steelblue  layui-btn-small"><span class="glyphicon glyphicon-pencil"></span> 打印</button>
                <button id="btnReplace" class="layui-btn layui-btn-blue layui-btn-small"><span class="glyphicon glyphicon-refresh"></span> 刷新</button>
            </div>
        </div>
        <div class="layui-tab-content" style="overflow-x: scroll; white-space: nowrap;">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th hidden></th>
                        <th></th>
                        <th hidden>缴税起始日期</th>
                        <th hidden>缴税终止日期</th>
                        <th hidden>租赁开始日期</th>
                        <th hidden>租赁终止日期</th>
                        <th>受理单号</th>
                        <th>身份证号</th>
                        <th>纳税人</th>
                        <th>受理状态</th>
                        <th>联系方式</th>
                        <th>税号</th>
                        <th>付款人</th>
                        <th>产权</th>
                        <th>房屋属性</th>
                        <th>面积</th>
                        <th>租金</th>
                        <th>地址</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (var item in Model.PageData)
                    {
                        <tr>
                            <td hidden>@item.Acceptance_Id</td>
                            <td><input type="radio" name="chk" id="@item.Acceptance_Id" value="@item.Acceptance_Id" /></td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxStartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_TaxEndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            @if (@item.Lease_StartTime != null)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_StartTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td  hidden>无</td>
                            }
                            @if (@item.Lease_EndTime != null)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Lease_EndTime.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td hidden>无</td>
                            }
                            
                            <td>@item.Acceptance_TicketNumber</td><!-- 6 -->
                            <td>@item.NatPer_IDNumber</td><!-- 7 -->
                            <td>@item.NatPer_Name</td><!-- 8 -->
                            <td>@item.State</td><!-- 9 -->
                            <td>@item.NatPer_Phone</td><!-- 10 -->
                            <td>@item.Acceptance_TaxNumber</td><!-- 11 -->
                            <td>@item.Tenant_Name</td><!-- 12 -->
                            <td>@item.Csqx</td><!-- 13 -->
                            <td>@item.AHA</td><!-- 14 -->
                            <td>@item.Hs_Proportion</td><!-- 15 -->
                            <td>@(item.LeaseRent*0.01)</td><!-- 16 -->
                            <td>@item.Acceptance_Address</td><!-- 17 -->
                            <td hidden>@item.Lease_Id</td><!-- 18 -->
                            <td hidden>@item.Acceptance_State</td><!-- 19 -->
                            <td hidden>@item.ReviewUser</td><!-- 20 -->
                            <td hidden>@(item.ReviewRent*0.01)</td><!-- 21 -->
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Acceptance_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            <td hidden>@TimeHelper.TimeStampToDateTime(item.Now_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            @if (item.Review_Date != 0)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Review_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td hidden></td>
                            }
                            <td hidden>@item.Review_Comment</td><!-- 23 -->
                            <td hidden>@(item.EReviewRent*0.01)</td><!-- 24 -->
                            <td hidden>@item.EvaluateUser</td><!-- 25 -->
                            @if (item.Evaluate_Date != 0)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Evaluate_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td hidden></td>
                            }
                            <td hidden>@item.Evaluate_Comment</td><!-- 27 -->
                            <td hidden>@item.ExamineUser</td><!-- 28 -->
                            @if (item.Examine_Date != 0)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Examine_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td hidden></td>
                            }
                            <td hidden>@item.Examine_Comment</td><!-- 30 -->
                            <td hidden>@(item.Pt_ActualTax*0.01)</td><!-- 31 -->
                            <td hidden>@item.PtUser</td><!-- 32 -->
                            @if (item.Pt_Date != 0)
                            {
                                <td hidden>@TimeHelper.TimeStampToDateTime(item.Pt_Date.ToString(), TimeHelper.ToTimeType.link_ymd)</td>
                            }
                            else
                            {
                                <td hidden></td>
                            }
                        </tr>
                    }
                </tbody>

            </table>
        </div>
        <div class="col-sm-12">
            <div class="col-sm-10">
                @Html.Pager(Model.PageData, new PagerOptions { PageIndexParameterName = "index", ContainerTagName = "ul", PrevPageText = "上页", NextPageText = "下页", FirstPageText = "首页", LastPageText = "尾页", CssClass = "pagination", PagerItemsSeperator = "", CurrentPagerItemWrapperFormatString = "<li class=\"active\"><a href=\"#\">{0}</a></li>", PagerItemWrapperFormatString = "<li>{0}</li>" }, new { id = "bootstrappager", @class = "pagination" })
            </div>
            <div class="col-sm-2 to-righjt">
                共 @Model.PageData.TotalItemCount 条记录，页 @Model.PageData.CurrentPageIndex/@Model.PageData.TotalPageCount
            </div>
        </div>
    </div>
    <!-- 打印模态 -->
    <div hidden class="content">
        <div id="modalPrint">
            <p class="h1" align="center">
                纳税事项通知书
            </p>
            <p class="p2" align="left">
                尊敬的纳税人：
            </p>
            <p class="p1" align="left">
                您办理的个人出租房屋登记申请，于<label class="lable2" id="Acceptance_Date"></label>办理完成，
            </p>
            <p class="p2" align="left">
                其出租房屋涉税受理单号为<label class="label1" id="Acceptance_TicketNumber"></label>,
                纳税人名称为<label class="label1" id="NatPer_Name"></label>。
            </p>
            <p class="p2">
                房屋地址为：<label class="label1" id="Acceptance_Address"></label>。
            </p>
            <p class="p2">
                月租金为：<label class="label1" id="LeaseRent"></label>。
            </p>

            <p class="p1" align="left">
                请携带相关手续到街办综治办，办理相关涉税事宜。
            </p>
            <p class="p5" align="right">
                <label class="lable2" id="Dt_Name"></label>
            </p>
            <p class="p5" align="right">
                <label class="lable2" id="Now_Date"></label>
            </p>
        </div>
    </div>

</body>
</html>
<script>
    /**
      * 刷新
      **/
    $(function () {
        $("#btnReplace").click(function () {
            Replace();
        })
    })


    /*
  * 打印
  */
    $(function () {
        $("#btnPrint").click(function () {
            var Acceptance_Id = CheckboxValueIDs(); //获取单选按钮的值 
            if (Acceptance_Id.length == 0) {
                layer.msg("请选择要打印的信息！");                                                             //未选中任何行
                return;
            }
            if (Acceptance_Id.length > 1) {
                layer.msg("只能选择一条信息");                                                             //未选中任何行
                return;
            }
            GetPrintArea(Acceptance_Id);
            //Lodop打印控件
                var LODOP = getLodop(document.getElementById('LODOP_OB'), document.getElementById('LODOP_EM'));
                LODOP = getLodop();
                LODOP.PRINT_INIT("街道办打印通知书");
                var Acceptance_Date = document.getElementById('Acceptance_Date').innerHTML;
                var NatPer_Name = document.getElementById('NatPer_Name').innerHTML;
                var Acceptance_Address = document.getElementById('Acceptance_Address').innerHTML;
                var LeaseRent = document.getElementById('LeaseRent').innerHTML;
                var Acceptance_TicketNumber = document.getElementById('Acceptance_TicketNumber').innerHTML;
                var Dt_Name = document.getElementById('Dt_Name').innerHTML;
                var Now_Date = document.getElementById('Now_Date').innerHTML;
                LODOP.ADD_PRINT_TEXT(95, 250, 701, 800, "纳税事项通知书");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 25);
                LODOP.ADD_PRINT_TEXT(160, 90, 701, 800, "尊敬的纳税人：");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(200, 135, 701, 800, "您办理的个人出租房屋登记申请，于" + Acceptance_Date + "办理完成。");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(240, 90, 701, 800, "其出租房屋涉税受理单号为：" + Acceptance_TicketNumber);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(280, 90, 701, 800, "纳税人名称为：" + NatPer_Name);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(320, 90, 701, 800, "房屋地址为：" + Acceptance_Address);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(360, 90, 701, 800, "月租金为：" + LeaseRent + "元");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(400, 135, 701, 800, "请携带相关手续到街办综治办，办理相关涉税事宜。");
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(470, 530, 701, 800, Dt_Name);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.ADD_PRINT_TEXT(510, 530, 701, 800, Now_Date);
                LODOP.SET_PRINT_STYLEA(0, "FontSize", 16);
                LODOP.PREVIEW();
        })
    })
    /**
       *打印取值
       */
    function GetPrintArea(Acceptance_Id) {
        GetDtName();
        var html = "";
        $("#NatPer_Name").html(getTableCell(8));
        $("#Acceptance_Address").html(getTableCell(17));
        $("#LeaseRent").html(getTableCell(16));
        $("#Acceptance_TicketNumber").html(getTableCell(6));
        $("#Acceptance_Date").html(getTableCell(22));
        $("#Now_Date").html(getTableCell(23));
    }
    /**
* 获取所属部门名称
*/
    function GetDtName() {
        var html = "";
        getAjax("/Base/GetDtName", "", function (data) {
            accordionJson = eval("(" + data + ")");
            $.each(accordionJson, function (i) {
                html += accordionJson[i].Dt_Name
                $("#Dt_Name").html(html);
            });

        });
    }

    ///详情
    $(function () {
        $("#btnMessage").click(function () {
            var checkId = CheckboxValueIDs();
            if (checkId.length == 0) {
                layer.msg("请选择要查看的租赁信息！");
                return;
            }
            if (checkId.length > 1) {
                layer.msg("仅可选择一行信息查看！");
                return;
            }
            $("#Acceptance_AddressD").val(getTableCell(17));
            $("#NatPer_NameD").val(getTableCell(8));
            $("#NatPer_PhoneD").val(getTableCell(10));
            $("#Hs_ProportionD").val(getTableCell(15));
            $("#LeaseRentD").val(getTableCell(16));
            $("#StateD").val(getTableCell(9));
            $("#NatPer_IDNumberD").val(getTableCell(7));
            $("#Lease_StartTimeD").val(getTableCell(4));
            $("#Lease_EndTimeD").val(getTableCell(5));
            $("#ReviewRent").val(getTableCell(21));
            $("#ReviewUser").val(getTableCell(20));
            $("#Review_Date").val(getTableCell(22));
            $("#Review_Comment").val(getTableCell(23));
            $("#EReviewRent").val(getTableCell(24));
            $("#EvaluateUser").val(getTableCell(25));
            $("#Evaluate_Date").val(getTableCell(26));
            $("#Evaluate_Comment").val(getTableCell(27));
            $("#ExamineUser").val(getTableCell(28));
            $("#Examine_Date").val(getTableCell(29));
            $("#Examine_Comment").val(getTableCell(30));
            $("#Pt_ActualTax").val(getTableCell(31));
            $("#PtUser").val(getTableCell(32));
            $("#Pt_Date").val(getTableCell(33));
            LayerOpen('900px', '650px', '受理单详情', $('#myModalDetails'));
        })
    })

    /**
   * 编辑受理单信息
   */

    $(function () {
        $("#btnUpdate").click(function () {

            var checkId = CheckboxValueIDs();           //获取选中行的受理单信息ID
            var NatPer_IDNumber = getTableCell(7);          //获取选中行的业主身份证
            var Acceptance_TaxStartTime = getTableCell(2);          //获取选中行的税起日期
            var Acceptance_TaxEndTime = getTableCell(3);          //获取选中行的税止日期
            var Acceptance_TaxNumber = getTableCell(11);          //获取选中行的税号
            var Acceptance_Address = getTableCell(17);          //获取选中行的地址
            var NatPer_Name = getTableCell(8);    //获取选中行的业主姓名
            var NatPer_Phone = getTableCell(10);   //获取选中行的业主电话
            var Hs_Proportion = getTableCell(15);        //获取选中行的房屋房屋面积
            var Lease_StartTime = getTableCell(4);      //获取选中行的租赁开始日期
            var Lease_EndTime = getTableCell(5);       //获取选中行的租赁截止日期
            var Lease_Rent = getTableCell(16);           //获取选中行的租金
            var Tenant_Name = getTableCell(12);          //获取选中行的租户名称
            var Lease_Id = getTableCell(18);
            if (checkId.length == 0) {
                layer.msg("请选择要编辑的受理单信息！");
                return;
            }
            if (checkId.length > 1) {
                layer.msg("仅可选择一条受理单信息进行编辑！");
                return;
            }
            $("#Acceptance_Id").val(checkId[0]);
            $("#Acceptance_TaxStartTime").val(Acceptance_TaxStartTime);
            $("#Acceptance_TaxEndTime").val(Acceptance_TaxEndTime);
            $("#Acceptance_TaxNumber").val(Acceptance_TaxNumber);
            $("#Acceptance_Address").val(Acceptance_Address);
            $("#NatPer_IDNumber").val(NatPer_IDNumber);
            $("#NatPer_Name").val(NatPer_Name);
            $("#NatPer_Phone").val(NatPer_Phone);
            $("#Hs_Proportion").val(Hs_Proportion);
            $("#Lease_Rent").val(Lease_Rent);
            $("#Lease_StartTime").val(Lease_StartTime);
            $("#Lease_EndTime").val(Lease_EndTime);
            $("#Tenant_Name").val(Tenant_Name);
            $("#Lease_Id").val(Lease_Id);
            LayerOpen('650px', '580px', '受理单修改', $('#myModal'));
        })
    })

</script>

